package com.hxzy.tms.service;

import java.io.Serializable;

public class ServiceResult<T> implements Serializable {
    private static final long serialVersionUID = -980039089602991612L;

    public final int status;
    public final T data;
    public final String message;

    public ServiceResult(int status) {
        this.status = status;
        this.data = null;
        this.message = "";
    }

    public ServiceResult(int status, T data) {
        this.status = status;
        this.data = data;
        this.message = "";
    }

    public ServiceResult(int status, T data, String message) {
        this.status = status;
        this.data = data;
        this.message = message;
    }

    public String toJson() {
        return String.format("{\"status\":%d, \"message\":\"%s\"}", status, message);
    }
}
